<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="ie=edge">
	<title>Document</title>
</head>

<body>

	<?php

$expire = time() + 60 * 60 * 24 * 30;
setcookie("user", "runoob", $expire);

if(isset($_COOKIE["user"])) {
    echo "欢迎". $_COOKIE["user"] ."!<br>";
}else {
    echo "普通访客！<br>";
}

//设置cookie的过期时间为过去1小时
setcookie("user", "", time()-3600);

?>

</body>

</html>